<template>
    <div class="help-log-more-page" v-loading="loading">
        <div class="item" v-for="item in logList" :key="item.id">
            <div class="w-full flex justify-between items-center">
                <div class="left w-4/12">
                    <div class="flex items-center">
                        <img :src="item.icon || '@/assets/images/xxdt-logo.png'" alt="">
                        <div>
                            <div class="text-xl font-bold left-in">
                                <div class="left-in-title">{{ item.name }}</div>
                                <div class="right">
                                    <div class="right-title">{{ item.introduction }}</div>
                                    <div
                                        class="text-sm btn-txt cursor-pointer"
                                        @click="toDetail(item.id)">
                                        阅读详细 <i class="el-icon-arrow-right"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="text-date">{{ item.date }}</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="right-mob">
                <div class="right-title ellipsis-2">{{ item.introduction }}</div>
                <div
                    class="text-sm btn-txt cursor-pointer"
                    @click="toDetail(item.id)">
                    阅读详细 <i class="el-icon-arrow-right"></i>
                </div>
            </div>
            <div class="icon-border"></div>
        </div>
    </div>
</template>

<script>

export default {
    components: {
    },
    data() {
        return {
            loading: false,
            logList: [],
        };
    },
    methods: {
        fetch() {
            this.loading = true;
            API.get('../product_log').then(res => {
                this.logList = res || [];
            }).finally(() => this.loading = false);
        },
        toDetail(id) {
            this.$router.push({
                name: 'Help.Log',
                query: {id},
            });
        },
    },
    mounted() {
        this.fetch();

        const title = {
            ...this.$store.state.helpTitle,
            ...{
                two: {
                    title: '产品日志',
                    path: '/helps/container/log/more',
                },
            },
        };
        this.$store.commit('setHelpTitle', title);
    },
};
</script>

<style lang="scss">
.help-log-more-page {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 50px;

    @media (max-width: 960px) {
        padding: 0 20px;
    }

    .item {
        @media (max-width: 960px) {
            position: relative;
        }

        .left {
            @media (max-width: 960px) {
                width: 100%;
            }

            img {
                width: 80px;
                height: 80px;
                object-fit: contain;
                margin-right: 20px;
                border: 2px solid rgb(45, 112, 174);
                border-radius: 50%;

                @media (max-width: 960px) {
                    width: 60px;
                    height: 60px;
                    border-width: 1px;
                    margin-right: 22px;
                }
            }
        }

        .text-date {
            color: #B4B4B4;
            margin-top: 7px;
            font-size: 13px;

            @media (max-width: 960px) {
                font-size: 12px;
                line-height: 17px;
                margin-top: 3px;
            }
        }

        .left-in-title {
            width: 230px;
            word-break: break-all;
            line-height: 28px;

            @media (max-width: 960px) {
                width: initial;
                font-size: 16px;
                line-height: 22px;
            }
        }

        .left-in {
            position: relative;
        }

        .right {
            position: absolute;
            left: 250px;
            top: 0;
            width: 478px;
            font-weight: 400;

            @media (max-width: 960px) {
                display: none;
            }

            .right-title {
                font-size: 16px;
                color: #4A4A4A;
                margin-bottom: 9px;
                margin-top: 3px;
                line-height: 22px;
            }
        }

        .right-mob {
            position: absolute;
            top: 60px;
            left: 82px;

            @media (min-width: 961px) {
                display: none;
            }

            .right-title {
                font-size: 14px;
                color: #4A4A4A;
                margin-bottom: 9px;
                line-height: 20px;
            }
        }

        .icon-border {
            width: fit-content;
            height: 60px;
            border-right: 2px dashed rgb(45, 112, 174);
            margin-left: 40px;

            @media (max-width: 960px) {
                height: 82px;
                margin-left: 30px;
            }
        }

        .btn-txt {
            color: rgb(45, 112, 174);

            @media (max-width: 960px) {
                font-size: 13px;
            }
        }
    }

    .item:last-child {
        .icon-border {
            border: none;
            height: 0;

            @media (max-width: 960px) {
                height: 82px;
            }
        }
    }
}
</style>
